<?php

class AjaxController extends Zend_Controller_Action
{
	public function init()
	{
		$this->_helper->viewRenderer->setNoRender();   //view info disabled
		$this->_helper->getHelper('layout')->disableLayout(); //template disabled
	}
	
    public function indexAction()
    {}

    public function checkemailAction()
    {
    	$email = $this->getRequest()->getParam('email'); 
    	           
    	$user = new User();
   		if($user->checkEmailAlreadyTaken($email)){
            	$array = array("error","这个邮箱已经被注册过了"); 
            } else {
            	$array = array("correct","您可以使用这个邮箱"); 
            }
            
    	echo Zend_Json_Encoder::encode($array);
    	
    	
            
    /*	$request = $this->getRequest();  
 
        if ($request->isXmlHttpRequest()) {  
            $email = $request->getQuery('email');
            $user = new User();
            if($user->checkEmailAlreadyTaken($email)){
            	$array = array("error","这个邮箱已经被注册过了"); 
            } else {
            	$array = array("correct","您可以使用这个邮箱"); 
            }
            $this->_helper->getHelper('Json')->sendJson($array);  
        }  
    	*/
    	
    }

}

